package com.ansion.commonchat.contact.bean;

import android.graphics.drawable.Drawable;

import androidx.annotation.Keep;

import com.ansion.commonchat.R;
import com.ansion.commonchat.contact.ui.ContactItemOtherType;
import com.ansion.commonchat.contact.ui.ContactItemType;
import com.ansion.utils.ResourceUtils;

@Keep
public class ContactOtherBean extends ContactBaseBean {

    public @ContactItemOtherType
    int otherType;

    public ContactOtherBean(String uniqueTag) {
        setUniqueTag(ContactItemType.ItemTypeOther + uniqueTag);
        otherType = Integer.parseInt(uniqueTag);
        diffContent = getTitle();
        type = ContactItemType.ItemTypeOther;
    }

    public String getTitle() {
        String title = "";
        switch (otherType) {
            case ContactItemOtherType.TypeGroupChat: {
                title = ResourceUtils.getString(R.string.group_chat);
                break;
            }
            case ContactItemOtherType.TypeOfficialAccount: {
                title = ResourceUtils.getString(R.string.oa_official_account);
                break;
            }
            case ContactItemOtherType.TypeFileAssistant: {
                title = ResourceUtils.getString(R.string.baba_feedback_file_assistant);
                break;
            }
        }
        return title;
    }

    public Drawable getIcon() {
        Drawable icon = null;
        switch (otherType) {
            case ContactItemOtherType.TypeGroupChat: {
                icon = ResourceUtils.getDrawable(R.drawable.svg_ic_group);
                break;
            }
            case ContactItemOtherType.TypeOfficialAccount: {
                icon = ResourceUtils.getDrawable(R.drawable.b_ic_oa_guide);
                break;
            }
            case ContactItemOtherType.TypeFileAssistant: {
                icon = ResourceUtils.getDrawable(R.drawable.svg_ic_file_transfer);
                break;
            }
        }
        return icon;
    }

    @Override
    public int getType() {
        return ContactItemType.ItemTypeOther;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ContactOtherBean)) {
            return false;
        }
        ContactOtherBean that = (ContactOtherBean) o;
        return type == that.type && diffContent.equals(that.diffContent);
    }
}
